Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

101
Visualizações
possible unhandled promise rejection: "Unable to find any RSS element in feed

i found this error in other places but not with RSS feed.. so anyway, i'm trying to create a news app with react native using RSS feeds.. i got this one from "huffpost", was mainly logging on the browser (since it's the easier for me to use), i did fetch the data from the RSS feed, parsed it:

const getNews = async () => {
   fetch('https://peaceful-peak-58941.herokuapp.com/https://www.huffpost.com/section/front-page/feed?x=1')
  .then((response) => response.text())
  .then((responseData) => rssParser.parse(responseData))
  .then((rss) => {
    setArticles(rss.items)
  });
}

when i logged it i noticed that it logs twice, once when the state is still empty (still didn't get any feed yet), then the 2nd time is when i get the feed nd the data i need, i was like thats fine since it happened to me before in reactJs but it was "fine" at the time, now i was like okay let me try this on a mobile emulator.. but then instead of it just doing the same thing as in the browser, it just keeps giving me the error "possible unhandled promise rejection: "Unable to find any RSS element in feed" ", why doesn't it display the data since eventually it should get the data? (i tried again on the browser nd it seems to work) (using expo if it matters)

{articles.length > 0 ? articles.map(article=>(
       <View key={article.id} style={{width:"100%"}}>
           <Text style={styles.title}>{article.title}</Text>
           <Image  style={{width:'100%', height:"300px"}}
             source={{uri:`${article.enclosures[0].url}`}}/>
           <Text style={styles.description}>{article.description}</Text>
           
           </View>
     )) : <Text>...</Text>}
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Fetch will recieve OPTIONS first and send the actual data right after that. You can configure it so you can fetch without the annoying OPTIONS. Just add another parameter {method: 'get'}, in the fetch function

const getNews = async () => {
       fetch('https://peaceful-peak-58941.herokuapp.com/https://www.huffpost.com/section/front-page/feed?x=1', {method:'get'})
      .then((response) => response.text())
      .then((responseData) => rssParser.parse(responseData))
      .then((rss) => {
        setArticles(rss.items)
      });
    }
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda